		TITLE	GETSMMOD - Copyright (c) SLR Systems 1994

		INCLUDE	MACROS
		INCLUDE	SEGMENTS
		INCLUDE	MODULES

		PUBLIC	GET_SM_MODULE


		.DATA

		EXTERNDEF	CSEG_GARRAY:STD_PTR_S


		.CODE	ROOT_TEXT


GET_SM_MODULE	PROC
		;
		;EAX IS SEGMOD PHYSICAL, RETURN EAX IS PARENT MODULE GINDEX
		;
		ASSUME	EAX:PTR SEGMOD_STRUCT

		MOV	CL,[EAX]._SM_FLAGS_2
		MOV	EAX,[EAX]._SM_MODULE_CSEG_GINDEX

		AND	CL,MASK SM2_CSEG_DONE
		JNZ	L1$

		RET

L1$:
		CONVERT	EAX,EAX,CSEG_GARRAY
		ASSUME	EAX:PTR CSEG_STRUCT

		MOV	EAX,[EAX]._CSEG_PARENT_MOD_GINDEX

		RET

GET_SM_MODULE	ENDP


		END

